<template>
	<div>

		<div class="main">
			<div class="content">
				<view class="title"><text style="padding-left: 10px;">发布渠道信息>></text></view>
				<view class="item">
					<text>渠道简介</text><input maxlength="15" v-model="QUDAO_QDJJ" class="inputView"
						placeholder="请输入渠道简介" />
				</view>
				<view class="item">
					<text>渠道量级</text><input maxlength="4" v-model="QUDAO_QDLJ" class="inputView"
						placeholder="请输入渠道量级" />
				</view>
				<view class="item">
					<text>微信号码</text><input maxlength="20" v-model="QUDAO_WXHM" class="inputView"
						placeholder="请输入微信号码" />
				</view>
				<view class="item">
					<text>QQ号码</text><input maxlength="20" v-model="QUDAO_QQHM" class="inputView"
						placeholder="请输入QQ号码" />
				</view>
				<view class="item">
					<text>手机号码</text><input maxlength="11" v-model="QUDAO_SJHM" class="inputView"
						placeholder="请输入手机号码" />
				</view>
				<view class="item">

					<text>渠道类型</text>
					<select class="inputView" v-model="QUDAO_SSLX">
						<option value="1">个人</option>
						<option value="2">公司</option>
						<option value="3">团队</option>
						<option value="4">联盟</option>
						<option value="5">其它</option>
					</select>
				</view>
				<view class="item">
					<text>推广方式</text>
					<select class="inputView" v-model="QUDAO_QDLX">
						<option value="1">网站</option>
						<option value="2">应用</option>
						<option value="3">联盟</option>
						<option value="4">地推</option>
					</select>
				</view>
				<view class="item">
					<text>推广软件</text>
					<select class="inputView" v-model="QUDAO_TGLX">
						<option value="4">全部</option>
						<option value="1">安卓软件</option>
						<option value="2">IOS软件</option>
						<option value="3">PC软件</option>

					</select>
				</view>


				<view class="item">
					<text>渠道详情</text><input v-model="QUDAO_BZ" class="inputContent" placeholder="请输入渠道详情" />
				</view>
				<a class="item1_button" @click="send()">确定发布</a>

			</div>
		</div>

	</div>
</template>

<script>
	export default {
		data() {
			return {
				QUDAO_QDJJ: null,

				QUDAO_QDLJ: null,

				QUDAO_SSLX: 1,

				QUDAO_TGLX: 4,

				QUDAO_QDLX: 1,

				QUDAO_WXHM: null,

				QUDAO_QQHM: null,

				QUDAO_SJHM: null,

				QUDAO_BZ: null,


			}
		},
		props: {
			msg: String
		},
		mounted() {
			this.qq = this.$PublicData.UserData.qq;
			this.wx = this.$PublicData.UserData.wx;
			this.phone = this.$PublicData.UserData.phone;


		},

		methods: {
			async send() {
				console.log("QUDAO_SSLX", this.QUDAO_SSLX);
				console.log("QUDAO_TGLX", this.QUDAO_TGLX);
				console.log("QUDAO_QDLX", this.QUDAO_QDLX);
				if (this.$PublicData.getUserdata() == null ||
					this.$PublicData.getUserdata().userName == null) {
					this.$Utils.showErrorToast("请先登录");
					return;
				}
				if (this.QUDAO_QDJJ == null) {
					this.$Utils.showErrorToast("请输入渠道简介");
					return;
				}
				if (this.QUDAO_QDLJ == null) {
					this.$Utils.showErrorToast("请输入渠道量级（每月推广个数）");
					return;
				}
				if (this.QUDAO_WXHM == null && this.QUDAO_QQHM == null &&
					this.QUDAO_SJHM == null) {
					this.$Utils.showErrorToast("至少填写一个联系方式");
					return;
				}
				if (this.QUDAO_BZ == null || this.QUDAO_BZ.length < 5) {
					this.$Utils.showErrorToast("渠道详情不能小于5个字");
					return;
				}
				try {
					const res = await this.$postData({
						url: this.$apis.addqd,
						data: {
							QUDAO_QDJJ: this.QUDAO_QDJJ,
							QUDAO_QDLJ: this.QUDAO_QDLJ,
							QUDAO_SSLX: this.QUDAO_SSLX,
							QUDAO_TGLX: this.QUDAO_TGLX,
							QUDAO_QDLX: this.QUDAO_QDLX,
							QUDAO_WXHM: this.QUDAO_WXHM,
							QUDAO_QQHM: this.QUDAO_QQHM,
							QUDAO_SJHM: this.QUDAO_SJHM,
							QUDAO_BZ: this.QUDAO_BZ,
							QUDAO_USER: this.$PublicData.getUserdata().userName,
							QUDAO_APPUSERID: this.$PublicData.getUserdata().uid,
						}
					})
					uni.showToast({
						title: "发布成功",
						success: function() {
							uni.$emit('updateSize', 1);
							setTimeout(function() {
								uni.redirectTo({
									url: './qudao'
								})
							}, 1000, null);
						}
					})

				} catch (e) {
					console.log("eee: ", e);
					this.$Utils.showToast("发布失败：" + e);
				}
			},

		}


	}
</script>

<style>
	.main {
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.title {
		line-height: 45px;
		width: 100%;
		height: 45px;
		background: #E5E5E5;
		color: #000000;
	}

	.content {
		border: 1px solid #E5E5E5;
		align-items: center;
		flex-direction: column;
		width: 1200px;
		min-height: 950px;
		display: flex;
	}

	.item {
		margin-top: 10px;
		align-items: center;
		display: flex;
		min-height: 45px;
	}

	.inputView {
		padding-left: 10px;
		margin-left: 30px;
		height: 40px;
		width: 600px;
		border: 1px solid #E5E5E5;
	}

	.inputContent {
		text-align: start;
		padding-left: 10px;
		margin-left: 30px;
		height: 120px;
		width: 600px;
		border: 1px solid #E5E5E5;
	}

	.item1_button {
		letter-spacing: 0.2rem;
		margin-top: 0.8125rem;
		font-size: 1rem;
		width: 18.875rem;
		border: 0.0625rem solid #F99B15;
		border-radius: 0.3125rem;
		text-align: center;
		justify-content: center;
		align-items: center;
		display: flex;
		height: 2.5rem;
		background: #F99B15;
		color: #FFFFFF;
	}
</style>
